|
|
|
|
|
|
|
Next you need to use the Tools | Add Procedures dialog to create three new properties. Make CheckRange a Boolean Public property. Then make HighValue and LowValue Variant Public properties. |
|
|
|
|
| |
|
|
|
|
You might think that HighValue and LowValue should be declared numeric types, that is, Integer or Long. However, this may not be the best idea. Although Integers or Longs might be OK, what if you declare the property as Integer and want to set it to a number greater than 33000? Although a Long data type could accept the higher number, what if you wanted to set the property from within a code segment using an integer variable? Using a Variant data type and performing type checking gives you the greatest degree of flexibility. |
|
|
|
|
|
|
|
|
|
|
The code in Listing 5.24 shows you how to populate the Property Let and Get routines for the three new properties. |
|
|
|
|
|
|
|
|
Listing 5.24. Coding the Let and Get property routines. |
|
|
|
|
|
|
|
|
Public Property Get CheckRange() As Boolean
CheckRange = m_CheckRange
End Property
Public Property Let CheckRange(ByVal vNewValue As Boolean)
m_CheckRange = vNewValue
PropertyChanged "CheckRange"
End Property
Public Property Get LowValue() As Variant
'
LowValue = m_LowValue
'
End Property
Public Property Let LowValue(ByVal vNewValue As Variant)
'
If IsNumeric(vNewValue) = False Then
Error 380 ' invalid property value
Else
m_LowValue = vNewValue
PropertyChanged "LowValue"
End If
'
End Property |
|
|
|
|
|